package struts.filter;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import struts.bean.vo.StrutsXmlVO;
import struts.util.ParseXmlByDom4j;

public class ActionListener implements ServletContextListener {

	@Override
	public void contextInitialized(ServletContextEvent servletcontextevent) {
		ServletContext context=servletcontextevent.getServletContext();
		String configPath=context.getInitParameter("struts-config");
		String tomcatpath=context.getRealPath("\\");
		Map <String,StrutsXmlVO> map=ParseXmlByDom4j.initXml(tomcatpath+configPath);
		context.setAttribute("struts", map);
		System.out.println("信息：系统已经加载完成！");
	}

	@Override
	public void contextDestroyed(ServletContextEvent servletcontextevent) {
		System.out.println("信息：系统已经注销！");

	}

}
